CalConvert documentation

 

 Version 2.2.2                                                                                               December 1996 

©1996 Alessandro Levi Montalcini   Technical support, permissions, suggestions:
C.so Re Umberto 10                          Internet email: alm@torino.alpcom.it
10121 Torino                                   ftp://ftp.alpcom.it/software/mac/LMontalcini
Italy                                                ftp://ftp.alpcom.it/software/mac/LMontalcini/alm.html

Binary Software, Inc.                       Orders and registrations only:
2118 Wilshire Blvd Suite 900           Phone: (800) 8-BINARY (824-6279)
Santa Monica, CA 90403                   or: (310) 449-1481
United States of America                   Fax: (800) 555-7217 or (310) 449-1473
                                                        Internet email: sales@binarysoft.com
                                                        CompuServe email: 74220,3377
                                                        America Online email: BINARY SW
                                                        ftp://users.aol.com/binarysw/

• Shareware: $10
◊  This program is distributed as shareware: if you use it please honor the shareware system by sending $10 U.S. to Binary Software at the address above. You can email, fax, snail-mail, or call. When registering please specify the name and version of this program as well as your name, mailing address, email address, phone number, fax number, and your credit card number and expiration date (we accept Visa, MasterCard, American Express, and Discover). You can also pay with a check, money order, or cash.
◊  Binary Software is only collecting the registrations on my behalf; please contact me directly by email for any information, suggestion, permission, or request about this software. If you want to send non-U.S. cash or any other material including software, books, magazines, CD-ROMs or any hardware, please send it to me at my Italian address. If you do so, however, you should also notify me by email because I only receive my snail mail once per month.
◊  If you can’t afford to register you may still want to send Binary Software your name, address and email address so they can send you new product announcements and other special offers.
◊  Site licenses and group discounts are available for 5 or more registrations. Please check my ftp site or send email for more information.
◊  Please register: your support is the only way for me to keep working on cool shareware programs.

• Introduction
◊  CalConvert is a small shareware utility that does integer arithmetic calculations and converts integer values to different bases (decimal, hexadecimal, binary, octal or any custom base between 2 and 32) or to an OSType (a sequence of four ASCII characters). The conversion may be signed or unsigned (you can always enter a signed value, it gets converted to unsigned if needed); the result may be interpreted either as a word (2 bytes) or as a long word (4 bytes). Version 2.0 sports a new clickable bit field display for easy bit-by-bit manipulations. The Return and Enter keys start the conversion; Tab, shift-Tab and the four arrow keys have their usual meanings.

• Configuration
◊  Choosing the “Fields” item from the “Options” menu brings up a configuration dialog that can be used to fully customize CalConvert. CalConvert can show up to 8 fields; each field contains either a mathematical expression, a sequence of 1 to 4 characters (OSType) or an integer number in any base from 2 to 32.
◊  Version 2.0 comes with Font and Size menus that can be used to change the window’s look and size.
◊  Checking the Delay Font Menu option lets you launch CalConvert without immediately building the Font menu, which makes it open much quicker. You can then build the Font menu when needed by choosing Build Font Menu from the Font menu itself.

• The calculator
◊  You may enter mathematical or logical expressions in fields labeled “Math”, i.e. things like “(12*(128-$20))<<2+2^8”; the result is shown in all the other fields of the window when you press Return or Enter or click the “=” button. If the expression can’t be parsed correctly, CalConvert beeps and all other fields are set to zero. The next paragraphs explain the syntax and operators you may use in your mathematical expressions.

• Syntax of the math field
◊  xxx (x=0-9) is a number
◊  $xxx (x=0-9,A-F) is an hexadecimal number
◊  -xxx, -$xxx, $-xxx are negative numbers
◊  '(' and ')' can be used as usual, nesting allowed
◊  spaces are allowed between numbers and operators
◊  no spaces are allowed inside numbers or operators
◊  all numbers are interpreted as 32-bit signed integers

• Order of operators
◊  Operators in the upper lines are calculated first.
◊  Operators in the same line are calculated sequentially.

   ^   **
   *   /   :   %   <<  >>
   &   |   \   AND OR  XOR
   +   -
   =   ==  !=  <>  <   >   <=  >=

• Arithmetic operators

  +     add
  -     subtract
  *     multiply
  /     divide
  :     divide
  %     remainder
  ^     power
  **    power

• Logical operators
    (return 1 if true, 0 if false)

  =     equal to
  ==    equal to
  !=    not equal to
  <>    not equal to
  <     less than
  >     greater than
  <=    less or equal
  >=    greater or equal

• Bitwise operators

  <<    bit shift left
  >>    bit shift right
  &     bit and
  AND   bit and
  and   bit and
  |     bit or
  OR    bit or
  or    bit or
  \     exclusive or
  XOR   exclusive or
  xor   exclusive or

• Version history
◊  2.2.2 - Added an option not to build the Font menu right away, to speed up the launch process when lots of fonts are installed. Fixed the parser so that it now complains about dangling operators at the end of the expression.
◊  2.2.1 - Recompiled with CodeWarrior 9 and updated documentation.
◊  2.2 - Fixed a bug in the parser that caused bad prioritization of the operators for some complex expressions that didn’t use parenthesis (thanks to Paolo Sasso for finding out the problem).
◊  2.1 - Uses the color utilities pattern as a background pattern under System 7.5 or later. You can set the utilities pattern by holding down the option key inside System 7.5’s Desktop Patterns utility.
◊  2.0 - Added a clickable bit-by-bit representation, font and size menus, “long word” and “unsigned” check boxes and an “evaluate” button; most of the interface code was rewritten to make the CalConvert window a configurable stand-alone code module.
◊  1.2.3 - CalConvert now refuses exponents larger than 32.
◊  1.2.2 - Made the fields dialog movable.
◊  1.2.1 - Cleaned up the code and updated documentation.
◊  1.2 - Recompiled as a fat binary, runs native on Power Macs.
◊  1.1 - Removed System 7 dependance and custom window definition.
◊  1.06 - Added online help, changed menu keys to follow Apple guidelines.
◊  1.05 - Fixed incoherent behavior of the “Fields” dialog.
◊  1.04 - Changed name to CalConvert.
◊  1.03 - First shareware version with arithmetic parser.
◊  1.02 - First public release as QuickConvert.
◊  1.01 - Menus added, still looks like a quick hack.
◊  1.0 - Written for my personal use only, very poor interface.

• Distribution
◊  This software is ©1995-96 Alessandro Levi Montalcini. It can be freely distributed as long as it is not modified and there’s no charge for it, but it may not be included in any commercial package without my consent.
◊  All online services and bulletin boards may make it available to their users at no charge other than the normal connection fees.
◊  All non-profit user groups may distribute it at no charge.
◊  All magazines may publish it on floppy disk or CD-ROM without asking me first, as long as I get a copy of the issue containing my software.
◊  All CD-ROM shareware collections and CD-ROM magazines may include it without my prior consent, as long as I get either a copy of the CD-ROM or an offer to buy the CD-ROM at a discounted price.
◊  All redistribution companies such as Pacific HiTech, AMUG, Celestin or Educorp may distribute it, as long as I get a copy of each media containing my software and a catalog of the company’s offerings (where applicable).
◊  You may find the latest version of all my shareware and freeware programs by anonymous ftp to ftp.alpcom.it, inside the /software/mac/LMontalcini directory. The ALM Share and ALM Free packages, which contain most of my stuff and can be registered at a very low price, are also available there.

• Disclaimer
◊  This software should never cause any damage, but you’re using it at your own risk. As an independent software developer, I can make no warranties whatsoever on it.

• Have fun!
◊  And don’t forget to register your shareware, so that more cool inexpensive utilities can see the light in the future.